<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>基本标签 |  zfy的个人博客</title>
    <meta name="generator" content="VuePress 1.9.7">
    <link rel="icon" href="./img/Scorpio.png">
    <link rel="stylesheet" href="./css/style.css">
    <meta name="description" content="My tech blog">
    
    <link rel="preload" href="./assets/css/0.styles.cfdaa54c.css" as="style"><link rel="preload" href="./assets/js/app.7878252f.js" as="script"><link rel="preload" href="./assets/js/2.877879cc.js" as="script"><link rel="preload" href="./assets/js/35.2b4d0231.js" as="script"><link rel="prefetch" href="./assets/js/10.a489e96f.js"><link rel="prefetch" href="./assets/js/11.f6f26a2f.js"><link rel="prefetch" href="./assets/js/12.8a827e29.js"><link rel="prefetch" href="./assets/js/13.e420b04a.js"><link rel="prefetch" href="./assets/js/14.52f00cc6.js"><link rel="prefetch" href="./assets/js/15.ef68d553.js"><link rel="prefetch" href="./assets/js/16.c2999dfd.js"><link rel="prefetch" href="./assets/js/17.0adb748c.js"><link rel="prefetch" href="./assets/js/18.2c077020.js"><link rel="prefetch" href="./assets/js/19.013b5e02.js"><link rel="prefetch" href="./assets/js/20.bb3b854e.js"><link rel="prefetch" href="./assets/js/21.28efc78c.js"><link rel="prefetch" href="./assets/js/22.4a1d71dd.js"><link rel="prefetch" href="./assets/js/23.605a5451.js"><link rel="prefetch" href="./assets/js/24.66bf035d.js"><link rel="prefetch" href="./assets/js/25.fbe72655.js"><link rel="prefetch" href="./assets/js/26.3f374d1f.js"><link rel="prefetch" href="./assets/js/27.556ea617.js"><link rel="prefetch" href="./assets/js/28.0cab868b.js"><link rel="prefetch" href="./assets/js/29.564f8747.js"><link rel="prefetch" href="./assets/js/3.4cfb1b9c.js"><link rel="prefetch" href="./assets/js/30.c4a099d1.js"><link rel="prefetch" href="./assets/js/31.7fbc3d2a.js"><link rel="prefetch" href="./assets/js/32.8f356b20.js"><link rel="prefetch" href="./assets/js/33.b5a1b0bb.js"><link rel="prefetch" href="./assets/js/34.57086c2e.js"><link rel="prefetch" href="./assets/js/36.a99f6d64.js"><link rel="prefetch" href="./assets/js/37.eb25dcef.js"><link rel="prefetch" href="./assets/js/38.e45d8594.js"><link rel="prefetch" href="./assets/js/39.213e3a72.js"><link rel="prefetch" href="./assets/js/4.b86a0fbe.js"><link rel="prefetch" href="./assets/js/40.cadafdd6.js"><link rel="prefetch" href="./assets/js/41.23b0f26d.js"><link rel="prefetch" href="./assets/js/42.7c2b83c6.js"><link rel="prefetch" href="./assets/js/43.62f328ea.js"><link rel="prefetch" href="./assets/js/44.c4dfbd34.js"><link rel="prefetch" href="./assets/js/45.cde5bb22.js"><link rel="prefetch" href="./assets/js/46.6c62bdb8.js"><link rel="prefetch" href="./assets/js/47.4857766a.js"><link rel="prefetch" href="./assets/js/48.55a0cccc.js"><link rel="prefetch" href="./assets/js/49.3dceda91.js"><link rel="prefetch" href="./assets/js/5.13776f82.js"><link rel="prefetch" href="./assets/js/50.ab4d52fa.js"><link rel="prefetch" href="./assets/js/51.69ccc35a.js"><link rel="prefetch" href="./assets/js/52.01f3f711.js"><link rel="prefetch" href="./assets/js/53.c146a1ff.js"><link rel="prefetch" href="./assets/js/54.71ce70c2.js"><link rel="prefetch" href="./assets/js/55.98ef481d.js"><link rel="prefetch" href="./assets/js/56.b23daa51.js"><link rel="prefetch" href="./assets/js/57.6aa314ad.js"><link rel="prefetch" href="./assets/js/58.7d6367d9.js"><link rel="prefetch" href="./assets/js/59.88894cf5.js"><link rel="prefetch" href="./assets/js/6.93d89692.js"><link rel="prefetch" href="./assets/js/60.111f9a04.js"><link rel="prefetch" href="./assets/js/61.add82aab.js"><link rel="prefetch" href="./assets/js/62.8bfac830.js"><link rel="prefetch" href="./assets/js/63.db44a5ca.js"><link rel="prefetch" href="./assets/js/64.0244f0ef.js"><link rel="prefetch" href="./assets/js/65.2be994de.js"><link rel="prefetch" href="./assets/js/66.c5066e37.js"><link rel="prefetch" href="./assets/js/67.c11b474b.js"><link rel="prefetch" href="./assets/js/68.276bdc3e.js"><link rel="prefetch" href="./assets/js/69.f5f39d50.js"><link rel="prefetch" href="./assets/js/7.ca9f7e96.js"><link rel="prefetch" href="./assets/js/70.e3ca02b0.js"><link rel="prefetch" href="./assets/js/71.befcf8f7.js"><link rel="prefetch" href="./assets/js/72.04fabafd.js"><link rel="prefetch" href="./assets/js/73.e5b707f2.js"><link rel="prefetch" href="./assets/js/74.b5668150.js"><link rel="prefetch" href="./assets/js/75.eb7cfac9.js"><link rel="prefetch" href="./assets/js/76.c1b76370.js"><link rel="prefetch" href="./assets/js/77.5875e953.js"><link rel="prefetch" href="./assets/js/78.a5e2fa5b.js"><link rel="prefetch" href="./assets/js/79.eb2d51a7.js"><link rel="prefetch" href="./assets/js/8.570c39ea.js"><link rel="prefetch" href="./assets/js/80.7252ac50.js"><link rel="prefetch" href="./assets/js/81.eb980d26.js"><link rel="prefetch" href="./assets/js/82.9e069d8f.js"><link rel="prefetch" href="./assets/js/83.8c5a6dc6.js"><link rel="prefetch" href="./assets/js/84.26baaa09.js"><link rel="prefetch" href="./assets/js/85.96bc7e77.js"><link rel="prefetch" href="./assets/js/86.9c9dd1ca.js"><link rel="prefetch" href="./assets/js/87.d54639b8.js"><link rel="prefetch" href="./assets/js/88.3d3ae1e1.js"><link rel="prefetch" href="./assets/js/89.a81caa83.js"><link rel="prefetch" href="./assets/js/9.7a58df3d.js"><link rel="prefetch" href="./assets/js/90.c3c347ed.js"><link rel="prefetch" href="./assets/js/91.b6240032.js"><link rel="prefetch" href="./assets/js/92.8331718a.js"><link rel="prefetch" href="./assets/js/93.ca174cfa.js"><link rel="prefetch" href="./assets/js/94.fec3300c.js"><link rel="prefetch" href="./assets/js/95.076b06fb.js"><link rel="prefetch" href="./assets/js/96.8ed8b32f.js">
    <link rel="stylesheet" href="./assets/css/0.styles.cfdaa54c.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/./" class="home-link router-link-active"><!----> <span class="site-name"> zfy的个人博客</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="http://127.0.0.1:3002/" target="_blank" rel="noopener noreferrer" class="nav-link external">
  自由博客板块
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></div><div class="nav-item"><a href="http://zfyangelo.gitee.io/yu-weather-web-show/" target="_blank" rel="noopener noreferrer" class="nav-link external">
  天气预报
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></div><div class="nav-item"><a href="/./guide/" class="nav-link router-link-active">
  个人的学习笔记
</a></div><div class="nav-item"><a href="/./baodian/interview/" class="nav-link">
  项目及在校经历
</a></div><div class="nav-item"><a href="/./baodian/talk/" class="nav-link">
  爱好和联系方式
</a></div><div class="nav-item"><a href="https://gitee.com/zfyangelo" target="_blank" rel="noopener noreferrer" class="nav-link external">
  我的gitee
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></div> <!----></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="http://127.0.0.1:3002/" target="_blank" rel="noopener noreferrer" class="nav-link external">
  自由博客板块
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></div><div class="nav-item"><a href="http://zfyangelo.gitee.io/yu-weather-web-show/" target="_blank" rel="noopener noreferrer" class="nav-link external">
  天气预报
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></div><div class="nav-item"><a href="/./guide/" class="nav-link router-link-active">
  个人的学习笔记
</a></div><div class="nav-item"><a href="/./baodian/interview/" class="nav-link">
  项目及在校经历
</a></div><div class="nav-item"><a href="/./baodian/talk/" class="nav-link">
  爱好和联系方式
</a></div><div class="nav-item"><a href="https://gitee.com/zfyangelo" target="_blank" rel="noopener noreferrer" class="nav-link external">
  我的gitee
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></div> <!----></nav>  <ul class="sidebar-links"><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading open"><span>HTML</span> <span class="arrow down"></span></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/./guide/notes/html/互联网基本原理.html" class="sidebar-link">互联网基本原理</a></li><li><a href="/./guide/notes/html/02-基本标签.html" class="active sidebar-link">基本标签</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/./guide/notes/html/02-基本标签.html#创建第一个网页" class="sidebar-link">创建第一个网页</a></li><li class="sidebar-sub-header"><a href="/./guide/notes/html/02-基本标签.html#html-骨架的生成" class="sidebar-link">HTML 骨架的生成</a></li><li class="sidebar-sub-header"><a href="/./guide/notes/html/02-基本标签.html#网页的浏览方法" class="sidebar-link">网页的浏览方法</a></li><li class="sidebar-sub-header"><a href="/./guide/notes/html/02-基本标签.html#认识html骨架" class="sidebar-link">认识HTML骨架</a></li><li class="sidebar-sub-header"><a href="/./guide/notes/html/02-基本标签.html#head-头部标签" class="sidebar-link">head 头部标签</a></li><li class="sidebar-sub-header"><a href="/./guide/notes/html/02-基本标签.html#body存放用户看到的所有内容" class="sidebar-link">body存放用户看到的所有内容</a></li><li class="sidebar-sub-header"><a href="/./guide/notes/html/02-基本标签.html#特殊的字符" class="sidebar-link">特殊的字符</a></li><li class="sidebar-sub-header"><a href="/./guide/notes/html/02-基本标签.html#常用块级和行内元素" class="sidebar-link">常用块级和行内元素</a></li></ul></li><li><a href="/./guide/notes/html/11-表单.html" class="sidebar-link">表单元素</a></li></ul></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>CSS</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Javascipt</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>HTML&amp;CSS练习</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Javascipt练习</span> <span class="arrow right"></span></p> <!----></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="基本标签"><a href="#基本标签" class="header-anchor">#</a> 基本标签</h1> <h2 id="创建第一个网页"><a href="#创建第一个网页" class="header-anchor">#</a> 创建第一个网页</h2> <p><strong>方法一</strong></p> <ol><li>创建一个空文件夹,在VScode编辑器中打开这个文件夹</li> <li>按ctrl + N快捷键新建文件，<strong>保存格式必须要手动填写html&quot;后缀</strong></li></ol> <p><strong>方法二</strong></p> <ol><li>在文件夹中直接点击鼠标右键&quot;新建文本文件&quot;</li> <li>将. txt格式文件改为. html文件</li></ol> <div class="custom-block tip"><p class="custom-block-title">TIP</p> <p>网页虽然是花花绿绿的，但是html文件本身是纯文本的</p></div> <h2 id="html-骨架的生成"><a href="#html-骨架的生成" class="header-anchor">#</a> HTML 骨架的生成</h2> <p><strong>输入! (英文模式下输入的感叹号) ,按tab键</strong>，即可自动生成HTML5的骨架</p> <p>如果骨架没有生成，就说明你没有将网页保存，或者网页保存格式不是. htm1后缀</p> <div class="custom-block tip"><p class="custom-block-title">TIP</p> <p>可以将输入法属性设置里调整为中文时使用英文标点</p> <p>注意要打开电脑的显示文件拓展名</p></div> <h2 id="网页的浏览方法"><a href="#网页的浏览方法" class="header-anchor">#</a> 网页的浏览方法</h2> <p><strong>方法一</strong></p> <ul><li>直接在文件夹中双击网页图标，即可查看网页</li></ul> <p><strong>方法二</strong></p> <ul><li>下载open in brower插件可以打开网页</li> <li>给VSCode安装Live Server插件,故名思议,这个插件可以让“实时热更新”网页， 自动刷新网页</li></ul> <p><img src="https://i.loli.net/2020/12/30/dbxSrRatAf3QOK8.png" alt="image-20201230154739874"></p> <p><img src="https://i.loli.net/2020/12/30/2TG9vpl61ONjiuW.png" alt="image-20201230155115743"></p> <p><img src="https://i.loli.net/2020/12/30/cqlTVROaYF9XJLK.png" alt="image-20201230155026813"></p> <div class="custom-block tip"><p class="custom-block-title">TIP</p> <p>使用with live server这种方法必须注意:网页必须存放在文件夹中，且VSCode已经打开这个文件夹</p> <p>Chrome浏览器非常适合开发，<strong>所以要将Chrome浏览器设置为默认的浏览器哦</strong></p> <p>杀毒软件、管家通常会阻止这个操作</p> <p>请妥善设置杀毒软件相关设置</p></div> <h2 id="认识html骨架"><a href="#认识html骨架" class="header-anchor">#</a> 认识HTML骨架</h2> <p><img src="https://i.loli.net/2020/12/30/GMxRjmZtYJnouyX.png" alt="image-20201230155526443"></p> <p><strong>标签是由：小于号+中间字符+大于号组成的代码(注意:代码里所有字符都由英文字符组成)</strong></p> <p><strong>标签的形式</strong></p> <ul><li>单标签(形单影只)   比如meta标签</li> <li>双标签(成双成对)   比如html标签</li></ul> <p>HTML叫做“超文本标记语言”，超文本标记就是标签,<strong>这些标签都有不同的功能.</strong></p> <div class="custom-block tip"><p class="custom-block-title">TIP</p> <p>如果有/(斜杠)的为该标签的结束标签,没有的就为开始标签.</p> <p>在HTML4时代，单标签必须写一个结尾的反斜杠，例如&lt;meta charset=&quot;UTF-8&quot;/&gt; HTML5不用写.</p> <p><strong>标签即元素,元素即标签.</strong></p></div> <h3 id="文档类型声明dtd"><a href="#文档类型声明dtd" class="header-anchor">#</a> 文档类型声明DTD</h3> <ul><li><strong>HTML文件第一行必须是DTD (Document Type Definition文档类型声明)</strong></li> <li>不写DTD会引发浏览器的一些兼容问题</li> <li>不同版本的HTML有不同的DTD写法</li></ul> <details class="custom-block details"><summary>DETAILS</summary> <p>HTML5:&lt; !DOCTYPE html&gt;</p> <p>HTML4.01严格版:&lt; !DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01/ /EN&quot; &quot;http://www.w3.org/TR/html4/strict.dtd&quot;&gt;</p> <p>HTML4.01过渡版:&lt; !DOCTYPE HTML PUBLIC'//W3C//DTD HTML 4.01 Transitional/ /EN&quot; &quot;http://www.w3. org/TR/html4/lose. dtd&quot;&gt;</p> <p>HTML4.01框架版:&lt; !DOCTYPE HTML PUBLIC &quot;_//W3C//DTD HTML 4.01 Frameset//EN&quot; &quot;http://www.w3. org/TR/htm14/frameset.dtd&quot;&gt;</p></details> <p><strong>W3C组织</strong></p> <p>W3C (The World Wide Web Consortium, 万维网联合会)是万维网的主要国际标准组织。该联盟成立于1994年，负责制定Web标准，主要是HTML和CSS。</p> <p><img src="https://i.loli.net/2020/12/30/JRkfVQl9hrLHdKy.png" alt="image-20201230160701169"></p> <p><img src="https://i.loli.net/2020/12/30/DQOLksgnKTvexAq.png" alt="image-20201230161040017"></p> <p><img src="https://i.loli.net/2020/12/30/5U8Hqin9FwS2heX.png" alt="image-20201230161158180"></p> <h3 id="网页的字符集"><a href="#网页的字符集" class="header-anchor">#</a> 网页的字符集</h3> <p><img src="https://i.loli.net/2020/12/30/xRZwps2nyzg7tJC.png" alt="image-20201230161520255"></p> <p><img src="https://i.loli.net/2020/12/30/PGbRargM9WzEqUX.png" alt="image-20201230161416640"></p> <p><strong>UTF-8和gb2312</strong></p> <p><img src="https://i.loli.net/2020/12/30/3regfmOv1aTXpPj.png" alt="image-20201230161704191"></p> <div class="custom-block tip"><p class="custom-block-title">TIP</p> <p>无论使用哪种字符集，一定要在VScode编辑器中将文件也设置为相同字符集，否则会出现乱码，然后更改meta标签:</p> <p><img src="https://i.loli.net/2020/12/30/7ypZjeLONH2hiV3.png" alt="image-20201230162507312"></p> <p>Live Server插件不支持gb2312 (gbk) 字符集，只支持UTF-8字符集</p> <h3 id="网页的title"><a href="#网页的title" class="header-anchor">#</a> 网页的title</h3></div> <p><img src="https://i.loli.net/2020/12/30/hw5fjTu34MYpb1C.png" alt="image-20201230162949455"></p> <p><strong>title的用途</strong></p> <p><img src="https://i.loli.net/2020/12/30/vgYM6s2xPpNIBXU.png" alt="image-20201230163634963"></p> <p><img src="https://i.loli.net/2020/12/30/JbtXlOYjDfwvNVS.png" alt="image-20201230163412697"></p> <p>title标签用来设置网页的标题，文字会显示在浏览器的标签栏上</p> <div class="custom-block tip"><p class="custom-block-title">TIP</p> <p>title也是搜索引擎收录网站时显示的标题,为了吸引用户点击,合理设置title是必要的.</p> <p>SEO (Search Engine Optimization, 搜索引擎优化)利用搜索引擎的规则提高网站在有关搜索引擎内的自然排名,让网站在搜索引擎的结果中内占据领先地位，获得品牌收益</p></div> <p><strong>网页关键词和页面描述</strong></p> <p>使用meta标签设置网页关键词和描述，name属性非常关键,用来设置meta的具体功能</p> <p><img src="https://i.loli.net/2020/12/30/kvP9MInbzhjUO3E.png" alt="image-20201230165308708"></p> <h3 id="注释标签"><a href="#注释标签" class="header-anchor">#</a> 注释标签</h3> <ul><li><p>用法:代码的作用，含义，意图写在四个减号中间,内容不会被浏览器解析;</p></li> <li><p>让别人更能明白这段代码你写的是什么内容,有什么作用</p></li></ul> <h1 id="html-根标签"><a href="#html-根标签" class="header-anchor">#</a> html  根标签</h1> <blockquote><p>网页中的所有内容全部放在html标签内部;</p> <p>网页根标签 lang是language的缩写，代表是该网页属于哪一个国家或是地区的网页;不能写多个.</p> <p>如果是中文网站写中文,如果写英文,因为一些插件,会识别你这为英文网站并且提示你是否要翻译</p></blockquote> <h2 id="head-头部标签"><a href="#head-头部标签" class="header-anchor">#</a> head 头部标签</h2> <blockquote><p>header是网页的头部标签,head里面的内容不会直接出现在网页中,</p> <p>作用:</p> <p>主要是帮助游览器和搜索引擎去解析网页.</p></blockquote> <h3 id="title-标题标签"><a href="#title-标题标签" class="header-anchor">#</a> title  标题标签</h3> <blockquote><p><strong>title<code>中的内容会显示在游览器的标题栏</code>,游览器会根据title判断网页的主要内容</strong></p> <p>方便用户通过搜索网页的名字找到相应的网站.</p> <p>title标签的内容会作为搜索结果的超链接上的文字显示</p> <p>网页的名字,当把文档加入用户的收藏夹或书签列表时，标题标签的内容将成为该文档链接的默认名称</p> <p>**注意:**尽量把重要的关键词放在前面,关键词不要重复出现,尽量做到每个页面的title标题中不要设置相同的内容。</p></blockquote> <h3 id="meta标签-单标签"><a href="#meta标签-单标签" class="header-anchor">#</a> meta标签  单标签</h3> <p><strong>meta标签被称为网页的元数据</strong></p> <p>::: danger<code>元数据就是一些与</code>生俱来的底层数据,类比于相当于人的DNA. :::</p> <p><code>元数据就是一些与</code>生俱来的底层数据,类比于相当于人的DNA.</p> <div class="custom-block tip"><p class="custom-block-title">TIP</p> <p>我是谁我在那</p></div> <p><code>元数据就是一些与</code>生俱来的底层数据,类比于相当于人的DNA.</p> <p>作用告诉游览器和搜索引擎基本数据`</p> <h4 id="meta-charset-utf-8"><a href="#meta-charset-utf-8" class="header-anchor">#</a> meta charset=&quot;utf-8&quot;</h4> <blockquote><p>作用:网页文字的编码格式,避免乱码问题.</p> <p>游览器不知道网页文件的编码集的话就会导致乱码</p> <p>(计算机不认识中文,我们也可能不认识法语),写上utf-8就是支持中文的万国码.</p> <p>通过声明一个明确的字符编码，让浏览器轻松、快速的确定适合网页内容的渲染方式，通常指定为'UTF-8'。</p> <p>如果一个网页要显示很多国家的语言就开发出了utf-8,在开发中我们使用的字符集都是utf-8.</p></blockquote> <h4 id="meta-name-keywords-content-关键字信息"><a href="#meta-name-keywords-content-关键字信息" class="header-anchor">#</a> meta name=&quot;keywords&quot; content=&quot;关键字信息&quot;</h4> <blockquote><p>name属性指定网页的数据名称</p> <p>content属性指定数据的内容</p></blockquote> <blockquote><p>表示网页的关键字信息</p> <p>可以同时指定多个关键字没有限制,关键字之间用,隔开</p> <p>例如: 京东网站 content写网上购物,网上商城,家电,家居,母婴,图书,可以根据这些关键字找到网站</p></blockquote> <h4 id="meta-name-description-content-网页的描述信息"><a href="#meta-name-description-content-网页的描述信息" class="header-anchor">#</a> meta name=&quot;description&quot; content=&quot;网页的描述信息&quot;</h4> <blockquote><p>描述信息被搜索引擎采用后,作为页面的摘要去显示</p> <p>网站的描述会显示在搜索引擎的搜索结果中</p></blockquote> <h2 id="body存放用户看到的所有内容"><a href="#body存放用户看到的所有内容" class="header-anchor">#</a> body存放用户看到的所有内容</h2> <blockquote><p><strong>body是html的子元素,表现网页的主题部分.所有可见部分都应该放在body里面</strong></p> <p>可以存放包含文字,图片,视频,音频.整个网页就这四类资源</p></blockquote> <h3 id="div-division-划分区域标签"><a href="#div-division-划分区域标签" class="header-anchor">#</a> div(DIVision)  划分区域标签</h3> <blockquote><p>Div标签本身没有什么特别之处,没有语义，没有权重,</p> <p>div标签最大功劳的是替代了以前table标签布局,</p> <p>正因为没有语义我们可以利用idv在网页内容中划分出多个矩形区域,存放不一样的内容.</p> <p>一个个div就像一个个集装箱,我们去用这些集装箱去各式各样的物品,也就是我们去装我们的标签,来达到页面的位置布局.</p> <p>目前来说div还是我们主要的布局元素</p></blockquote> <h3 id="h标签正文中的标题"><a href="#h标签正文中的标题" class="header-anchor">#</a> h标签正文中的标题</h3> <blockquote><p>H标签的重要性仅次于页面Title,文章会有标题,如首页的logo上可以加H1标签,包含最重要的关键词.</p> <p>h1标签自带的权重使得网页的蜘蛛爬虫认为它最重要.</p> <p>一个页面最多一个h1标签,就像你生命中最重要的女人一个.</p> <p>更小的标题可以使用h3标签,没有明确的个数限制,但是要和h2有一定的比例关系,一个h2对应三个h3.就像一个公司最上面一个总裁,两三个副总裁,后面还有各个部门和职员一样.</p> <p>h分出的区域和div分出的区域用户看起来没有任何区别,</p> <p>标签写的更加符合规范时是给搜索引擎看的,搜索引擎只会收录一些比较重要的标签</p> <p>div京东和h1京东,h1写的京东肯定会被收录</p> <p>大量使用H标签反而会适得其反,使得主题不能突出,搜索引擎爬虫就不能正确的爬出你想要它爬出的内容.最终网站排名反而不好.</p></blockquote> <h3 id="ul-unordered-list-li-list-item-无序列表标签"><a href="#ul-unordered-list-li-list-item-无序列表标签" class="header-anchor">#</a> ul（ Unordered List) li  (list-item) 无序列表标签</h3> <blockquote><p>内容相似、结构相仿、布局接近使用无序列表.</p> <p><strong>使用li表示列表项</strong></p> <p>ul 标签子层级里只能写li标签.</p> <p>如果你想添加p,div等标签,你在li里面添加一万个都没关系.</p> <p>用ul标签划分出很多相同大区域,li划分大区域里面单个相似的区域.</p> <p>布局之前先做结构也是去用好标签,标签使用正确网络布局才可能正确.</p></blockquote> <p>属性:type</p> <ol><li>无序列表的符号,不建议去使用,但凡是样式的表现效果请使用css去实现.</li> <li>值:默认disc：实体圆、circle：空心圆、square：实体方块</li> <li>仅做了解</li></ol> <div class="language-html line-numbers-mode"><pre class="language-html"><code><span class="token comment">&lt;!-- 无序列表默认属性type的值是disc，disc定义一个实体圆，所以disc不用刻意去设置 --&gt;</span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>ul</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>li</span><span class="token punctuation">&gt;</span></span>我是第一个<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>li</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>li</span><span class="token punctuation">&gt;</span></span>我是第二个<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>li</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>li</span><span class="token punctuation">&gt;</span></span>我是第三个<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>li</span><span class="token punctuation">&gt;</span></span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>ul</span><span class="token punctuation">&gt;</span></span>


    <span class="token comment">&lt;!-- 这些都是通过type来定义的，circle是定义一个空心圆 --&gt;</span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>ul</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>circle<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>li</span><span class="token punctuation">&gt;</span></span>我是第一个<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>li</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>li</span><span class="token punctuation">&gt;</span></span>我是第二个<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>li</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>li</span><span class="token punctuation">&gt;</span></span>我是第三个<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>li</span><span class="token punctuation">&gt;</span></span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>ul</span><span class="token punctuation">&gt;</span></span>

    <span class="token comment">&lt;!-- square定义实体方块 --&gt;</span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>ul</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>square<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>li</span><span class="token punctuation">&gt;</span></span>我是第一个<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>li</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>li</span><span class="token punctuation">&gt;</span></span>我是第二个<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>li</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>li</span><span class="token punctuation">&gt;</span></span>我是第三个<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>li</span><span class="token punctuation">&gt;</span></span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>ul</span><span class="token punctuation">&gt;</span></span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br></div></div><h3 id="ol-ordered-lists-li-list-item-有序列表标签"><a href="#ol-ordered-lists-li-list-item-有序列表标签" class="header-anchor">#</a> ol（ ordered lists ）li  (list-item)  有序列表标签</h3> <blockquote><p>也是划分内容相似、结构相仿、布局接近的区域</p> <p>但是每个区域的内容是有先后关系的</p></blockquote> <p>属性:type</p> <ol><li>无序列表的符号,不建议去使用,但凡是样式的表现效果请使用css去实现.</li> <li>值:1、A、a、l、i、start.</li> <li>仅做了解</li></ol> <div class="language-html line-numbers-mode"><pre class="language-html"><code>	<span class="token comment">&lt;!-- 有序列表默认是数字往下计数的 --&gt;</span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>ol</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>li</span><span class="token punctuation">&gt;</span></span>我是第一个<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>li</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>li</span><span class="token punctuation">&gt;</span></span>我是第二个<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>li</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>li</span><span class="token punctuation">&gt;</span></span>我是第三个<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>li</span><span class="token punctuation">&gt;</span></span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>ol</span><span class="token punctuation">&gt;</span></span>
  

<span class="token comment">&lt;!-- 定义A，就是按照大写字母来计数的，当然了，不能直接定义B，它不是不会从B开始数的 --&gt;</span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>ol</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>A<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>li</span><span class="token punctuation">&gt;</span></span>我是第一个<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>li</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>li</span><span class="token punctuation">&gt;</span></span>我是第二个<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>li</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>li</span><span class="token punctuation">&gt;</span></span>我是第三个<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>li</span><span class="token punctuation">&gt;</span></span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>ol</span><span class="token punctuation">&gt;</span></span>
    

<span class="token comment">&lt;!-- 定义a，就是安装小写字母开始计数的 --&gt;</span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>ol</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>a<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>li</span><span class="token punctuation">&gt;</span></span>我是第一个<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>li</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>li</span><span class="token punctuation">&gt;</span></span>我是第二个<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>li</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>li</span><span class="token punctuation">&gt;</span></span>我是第三个<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>li</span><span class="token punctuation">&gt;</span></span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>ol</span><span class="token punctuation">&gt;</span></span>
    

<span class="token comment">&lt;!-- 定义I，就是按照大写罗马数字计数的 --&gt;</span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>ol</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>I<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>li</span><span class="token punctuation">&gt;</span></span>我是第一个<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>li</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>li</span><span class="token punctuation">&gt;</span></span>我是第二个<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>li</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>li</span><span class="token punctuation">&gt;</span></span>我是第三个<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>li</span><span class="token punctuation">&gt;</span></span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>ol</span><span class="token punctuation">&gt;</span></span>
    

<span class="token comment">&lt;!-- 定义i，就是按照大写罗马数字计数的 --&gt;</span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>ol</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>i<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>li</span><span class="token punctuation">&gt;</span></span>我是第一个<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>li</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>li</span><span class="token punctuation">&gt;</span></span>我是第二个<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>li</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>li</span><span class="token punctuation">&gt;</span></span>我是第三个<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>li</span><span class="token punctuation">&gt;</span></span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>ol</span><span class="token punctuation">&gt;</span></span>
    

<span class="token comment">&lt;!-- start属性，就是按照从多少数来计数，比如我想从3开始计数。start属性只能定义数字，不支持英文字母哦。--&gt;</span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>ol</span> <span class="token attr-name">start</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>3<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>li</span><span class="token punctuation">&gt;</span></span>我是第一个<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>li</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>li</span><span class="token punctuation">&gt;</span></span>我是第二个<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>li</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>li</span><span class="token punctuation">&gt;</span></span>我是第三个<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>li</span><span class="token punctuation">&gt;</span></span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>ol</span><span class="token punctuation">&gt;</span></span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br><span class="line-number">26</span><br><span class="line-number">27</span><br><span class="line-number">28</span><br><span class="line-number">29</span><br><span class="line-number">30</span><br><span class="line-number">31</span><br><span class="line-number">32</span><br><span class="line-number">33</span><br><span class="line-number">34</span><br><span class="line-number">35</span><br><span class="line-number">36</span><br><span class="line-number">37</span><br><span class="line-number">38</span><br><span class="line-number">39</span><br><span class="line-number">40</span><br><span class="line-number">41</span><br><span class="line-number">42</span><br><span class="line-number">43</span><br><span class="line-number">44</span><br><span class="line-number">45</span><br><span class="line-number">46</span><br></div></div><h3 id="dl-definition-list-dt-dd自定义列表标签"><a href="#dl-definition-list-dt-dd自定义列表标签" class="header-anchor">#</a> dl （ definition list) &gt; dt + dd自定义列表标签</h3> <div class="language-css line-numbers-mode"><pre class="language-css"><code>&lt;dl&gt;<span class="token comment">/*Definition List 定义列表*/</span>
	&lt;dt&gt;我是标题&lt;/dt&gt;<span class="token comment">/*Definition Term 定义项*/</span>
     &lt;dd&gt;我是正文，我必须长长长长长长长长长&lt;/dd&gt;<span class="token comment">/*Definition Description 定义描述*/</span>
&lt;/dl&gt;
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br></div></div><blockquote><p>内容不完全一样、结构相仿、布局接近、每个区域的内容没有先后关系的的区域</p> <p>从语义上来讲DT是名称,是标题,DD是解释,是内容.</p> <p>dt和dd标签是同级的,都放于dl标签之内,dt和dd不能相互嵌套.</p> <p>必须结合dl标签去使用dd,dt标签,不能单独使用dt,dd标签.</p></blockquote> <p><strong>ps:列表之间可以相互嵌套</strong></p> <h3 id="p-paragraph-标签-段落标签"><a href="#p-paragraph-标签-段落标签" class="header-anchor">#</a> p(paragraph)标签  段落标签</h3> <blockquote><p>作用:在网页上划分出一个专门存放大段文字的区域.</p></blockquote> <h3 id="span标签-划分文字区域"><a href="#span标签-划分文字区域" class="header-anchor">#</a> span标签 划分文字区域</h3> <blockquote><p><strong>作用:</strong></p> <p>​			在网页圈出内容进行单独处理</p> <p>如果一段文字某几个文字变需要变色和加背景颜色,那这些特殊的文字就用span去包裹.</p></blockquote> <h3 id="strong-b标签-重要文字标注"><a href="#strong-b标签-重要文字标注" class="header-anchor">#</a> strong b标签 重要文字标注</h3> <blockquote><p><strong>作用:</strong></p> <p>​			网页内容中的某段文字中间标注出特别重要的文字,会对相应的文字进行加粗处理.</p> <p>b标签只是规定文本加粗,是一个表现效果的标签</p> <p>strong还有除了文本加粗强调文字的作用.能让搜索引擎觉得里面的字很重要.</p></blockquote> <h3 id="em-i都为斜体标签"><a href="#em-i都为斜体标签" class="header-anchor">#</a> em i都为斜体标签</h3> <blockquote><p>em不仅能使文本变成斜体,而且还能够强调</p> <p>b标签只是规定文本变斜,是一个表现效果的标签</p> <p>但是i标签现在没有被淘汰,广泛应用于小图标上.(iconfont)</p></blockquote> <h3 id="blockquote-标签-用于大段引用文字展示"><a href="#blockquote-标签-用于大段引用文字展示" class="header-anchor">#</a> blockquote 标签   用于大段引用文字展示</h3> <blockquote><p>主要去划分区域展示引用的古典,名人名言.</p></blockquote> <h3 id="a标签"><a href="#a标签" class="header-anchor">#</a> a标签</h3> <blockquote><p>**a标签定义超链接，**用于从一张页面链接到另一张页面。</p> <p>链接:a 标签最重要的属性是 href 属性，它指示链接的目标。</p> <p>​	<strong>属性:</strong></p> <p>​				<strong>href 指定跳转的目标路径</strong></p> <p>​						<strong>1.值可以是一个外部网站的地址</strong></p> <p>​						<strong>2.值也可以写一个内部的地址</strong></p> <p>**锚点:**href=&quot;#ID名&quot; 跳转到页面的指定位置,   只需讲 href属性设置为  #目标元素id的属性值</p> <p>在开发中可以将#作为超链接的路径的占位符使用,会跳转页面的顶部</p> <p>可以使用javascript:;来作为href的属性,此时点击这个超链接什么也不会发生.</p></blockquote> <blockquote><p><strong>target属性</strong>   用来指定超链接的打开方式</p> <blockquote><p>target=&quot;_self&quot; 默认值 在当前窗口打开。</p> <p>target=&quot;__blank&quot; 在新窗口打开；</p></blockquote></blockquote> <h3 id="img标签"><a href="#img标签" class="header-anchor">#</a> img标签</h3> <blockquote><p>用于向当前页面引入一个外部图片</p></blockquote> <p><strong>属性</strong></p> <blockquote><p><strong>src=&quot;图片地址&quot;</strong>   src是sourse的缩写，表示我们需要显示的图片文件所在的位置</p> <p><strong>width/height</strong>     图片的宽高, (单位是像素)  最好写图片原始尺寸.</p> <p>​					  -宽度和高度如果只修改一个,另一个会等比例缩放</p> <p>​					**注意:**一般情况在pc端,不建议修改图片的大小,需要多大的图片就裁多大</p> <p>​								但是在移动端,经常需要对图片的缩放(一般是大图缩小)</p> <p><strong>alt</strong>图片描述  图片无法加载出来显示  搜索引擎会根据alt内容来识别图片,如果不写不会被搜索引擎收录</p> <p><strong>title</strong>鼠标悬停会出现文字提示</p></blockquote> <p><strong>常见的图片格式</strong></p> <blockquote><p><strong>jpeg(jpg)</strong></p> <p>​		    ---支持的颜色丰富,不支持透明效果,不支持动图</p> <p>​			---一般用来显示照片</p> <p><strong>gif</strong></p> <p>​			----支持的颜色比较少,支持简单透明,支持动图</p> <p>​			---颜色单一的图片,动图</p> <p><strong>png</strong></p> <p>​			---支持的颜色丰富</p> <p>​			---复杂透明的图片(专为网页而生的)</p> <p><strong>webp</strong></p> <p>​			---这是谷歌专门推出来表现网页中的图片的一种格式</p> <p>​			---它具备所有图片的优点,而且文件还特别小</p> <p>​			---缺点:兼容性不好</p> <p><strong>base64</strong></p> <p>​			---将图片使用base64进行编码,这样可以直接将图片直接转换为字符.通过字符的形				式引入图片</p> <p>​			---一般都是一些需要和网页一起加载的图片才会使用base64</p> <p>**原则: **效果一样,用小的</p> <p>​		效果不一样,用效果好的,同样考虑下图片大小</p></blockquote> <h3 id="video-视频标签"><a href="#video-视频标签" class="header-anchor">#</a> video    视频标签</h3> <blockquote><p>src=“视频地址”: 表示我们需要显示的视频文件所在的位置</p> <p><strong>支持格式</strong></p> <blockquote><p>MP4  WebM  Ogg</p></blockquote> <p><strong>属性:</strong></p> <p>​		controls  是否允许用户控制播放暂停</p> <p>​		autoplay 自动播放  打开页面时候自动播放,目前大部分游览器都不会对音乐自动播放</p> <p>​		loop  循环播放</p></blockquote> <h3 id="audio标签-音频标签"><a href="#audio标签-音频标签" class="header-anchor">#</a> audio标签  音频标签</h3> <blockquote><p>src=“视频地址”: 表示我们需要显示的视频文件所在的位置</p> <p>默认情况下不允许用户自己控制播放停止</p> <p><strong>属性:</strong></p> <p>​		controls  是否允许用户控制播放暂停</p> <p>​		autoplay 自动播放  打开页面时候自动播放,目前大部分游览器都不会对音乐自动播放</p> <p>​		loop  循环播放</p></blockquote> <p><strong>支持格式:</strong></p> <blockquote><p>wav、mp3、ogg</p></blockquote> <h3 id="pre标签"><a href="#pre标签" class="header-anchor">#</a> pre标签</h3> <blockquote><p>完全按照你的书写格式还原</p></blockquote> <h3 id="其他标签"><a href="#其他标签" class="header-anchor">#</a> 其他标签</h3> <p><code>s</code> <code>del</code>删除线</p> <p><code>u ins</code> 下划线</p> <p><code>big</code>文字变大115%    <code>small</code>文字变小85%</p> <p>hr 水平分割线  br换行</p> <p><code>sub</code>规定下标 <code>sup</code>规定上标</p> <div class="language-css line-numbers-mode"><pre class="language-css"><code>&lt;p&gt;  2h+o=h&lt;sub&gt;2&lt;/sub&gt;o  &lt;/p&gt;
&lt;p&gt;  3&lt;sup&gt;2&lt;/sup&gt;+4&lt;sup&gt;2&lt;/sup&gt;=5&lt;sup&gt;2&lt;/sup&gt;   &lt;/p&gt;
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><h2 id="特殊的字符"><a href="#特殊的字符" class="header-anchor">#</a> 特殊的字符</h2> <p>因为网页编写的多个空格默认情况下会自动被游览器解析为一个空格</p> <p>在html有些时候我们不能直接书写一些特殊符号.</p> <blockquote><p>比如:多个连续的空格,字母两侧的大于号和小于号</p></blockquote> <p>如果我们需要在网页中书写这些特殊的符号,则需要使用html中的实体(转义字符);</p> <p>实体的语法:</p> <blockquote><p>&amp;实体的名字</p></blockquote> <ul><li>空格; <code>&amp;nbsp;</code></li> <li>小于号: <code>&amp;lt;</code>    less than</li> <li>大于号: <code>&amp;gt;</code>    greater than</li> <li>版权符号 <code>&amp;copy;</code></li></ul> <h2 id="常用块级和行内元素"><a href="#常用块级和行内元素" class="header-anchor">#</a> 常用块级和行内元素</h2> <p><strong>块元素(block element)</strong></p> <blockquote><p>div h ol ul li dl dt dd p blockquote pre</p></blockquote> <p><strong>行内元素 (inline elemnet)</strong></p> <blockquote><p>a  b   strong  em  i  span    video  audio   img</p></blockquote> <p>块级元素独占一行,在网页中一般使用块元素进行页面的布局</p> <p>行内元素并列一行,主要用来包裹文字</p> <p>一般情况下我们在块级元素可以包裹任何类型的标签,行内元素只能包裹行内元素.</p> <p><strong>特殊:</strong></p> <blockquote><p>p元素不能放任何的块级元素.</p> <p>a标签可以放块级元素</p></blockquote> <h3 id="html标签语义化"><a href="#html标签语义化" class="header-anchor">#</a> HTML标签语义化</h3> <blockquote><p>HTML标签语义化就是用正确的标签做正确的事情,让标签有自己的含义。</p> <p>作用:</p> <p>​		让⻚⾯的内容结构化，便于对浏览器、搜索引擎解析；</p></blockquote> <div class="language-css line-numbers-mode"><pre class="language-css"><code>&lt;p&gt;一行文字&lt;/p&gt;
&lt;span&gt;一行文字&lt;/span&gt;
<span class="token comment">/*此时都是写了一行文字,而p标签的含义为段落,span标签则没有独特的含义.*/</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br></div></div><h3 id="代码规范-tab来缩进代码"><a href="#代码规范-tab来缩进代码" class="header-anchor">#</a> 代码规范:tab来缩进代码</h3> <blockquote><p>正确嵌套,元素嵌套就是一颗种族树,最上面是曾祖父,下面是所有的孩子和孙子.</p> <p>子层级代码相对父层级代码缩进一个tab.</p> <p>开始标签和结束标签发生换行请保证在竖直位置对齐.</p> <p>注意:我们一定要严格要求我们书写规范.</p> <p>在企业面试时面试官第一眼看的是代码格式.这是工程师的第一要求,也是工程师的自我修养.</p></blockquote></div> <footer class="page-edit"><!----> <!----></footer> <div class="page-nav"><p class="inner"><span class="prev">
      ←
      <a href="/./guide/notes/html/互联网基本原理.html" class="prev">
        互联网基本原理
      </a></span> <span class="next"><a href="/./guide/notes/html/11-表单.html">
        表单元素
      </a>
      →
    </span></p></div> </main></div><div class="global-ui"><!----><div class="reco-bgm-panel" data-v-b1d3339e><audio id="bgm" src="https://www.ytmp3.cn/down/75475.mp3" data-v-b1d3339e></audio> <div class="reco-float-box" style="bottom:30px;z-index:999999;display:none;" data-v-b1d3339e data-v-41bcba48 data-v-b1d3339e><img src="https://p1.music.126.net/qTSIZ27qiFvRoKj-P30BiA==/109951165895951287.jpg?param=200y200" data-v-b1d3339e></div> <div class="reco-bgm-box" style="left:10px;bottom:10px;z-index:999999;" data-v-b1d3339e data-v-41bcba48 data-v-b1d3339e><div class="reco-bgm-cover" style="background-image:url(https://p1.music.126.net/qTSIZ27qiFvRoKj-P30BiA==/109951165895951287.jpg?param=200y200);" data-v-b1d3339e><div class="mini-operation" style="display:none;" data-v-b1d3339e><i class="reco-bgm reco-bgm-pause" style="display:none;" data-v-b1d3339e></i> <i class="reco-bgm reco-bgm-play" style="display:none;" data-v-b1d3339e></i></div> <div class="falut-message" style="display:none;" data-v-b1d3339e>
          播放失败
        </div></div> <div class="reco-bgm-info" data-v-b1d3339e data-v-41bcba48 data-v-b1d3339e><div class="info-box" data-v-b1d3339e><i class="reco-bgm reco-bgm-music music" data-v-b1d3339e></i>花花公子</div> <div class="info-box" data-v-b1d3339e><i class="reco-bgm reco-bgm-artist" data-v-b1d3339e></i>马思唯/step.jad</div> <div class="reco-bgm-progress" data-v-b1d3339e><div class="progress-bar" data-v-b1d3339e><div class="bar" data-v-b1d3339e></div></div></div> <div class="reco-bgm-operation" data-v-b1d3339e><i class="reco-bgm reco-bgm-last last" data-v-b1d3339e></i> <i class="reco-bgm reco-bgm-pause pause" style="display:none;" data-v-b1d3339e></i> <i class="reco-bgm reco-bgm-play play" data-v-b1d3339e></i> <i class="reco-bgm reco-bgm-next next" data-v-b1d3339e></i> <i class="reco-bgm reco-bgm-volume1 volume" data-v-b1d3339e></i> <i class="reco-bgm reco-bgm-mute mute" style="display:none;" data-v-b1d3339e></i> <div class="volume-bar" data-v-b1d3339e><div class="bar" data-v-b1d3339e></div></div></div></div> <div class="reco-bgm-left-box" data-v-b1d3339e data-v-41bcba48 data-v-b1d3339e><i class="reco-bgm reco-bgm-left" data-v-b1d3339e></i></div></div></div></div></div>
    <script src="./assets/js/app.7878252f.js" defer></script><script src="./assets/js/2.877879cc.js" defer></script><script src="./assets/js/35.2b4d0231.js" defer></script>
  </body>
</html>
